fix(agglayer): fix incorrect stack comments#2681
Merged
Conversation
mmagician
reviewed
Mar 27, 2026
Fumuran
reviewed
Mar 29, 2026
Contributor
Fumuran
left a comment
There was a problem hiding this comment.
Looks good, thank you! I left two questions inline
Comment on lines
249
to
252
| repeat.2 | ||
| padw padw swapdw | ||
| end | ||
| # => [ASSET_KEY, ASSET_VALUE, pad(16)] |
Contributor
There was a problem hiding this comment.
Judging by the code below, we will use almost all of the 16 pads here (only 15 of them, to be precise). Not sure why it works now, but probably we should add another padw padw swapdw here
Member
Author
There was a problem hiding this comment.
I am not sure about this, because we add 16 pad elements here before doing the FPI call.
Contributor
There was a problem hiding this comment.
Ah, my bad, somehow I missed that we already have repeat.2 here. Yep, in that case all looks good!
Fumuran
approved these changes
Mar 30, 2026
Comment on lines
249
to
252
| repeat.2 | ||
| padw padw swapdw | ||
| end | ||
| # => [ASSET_KEY, ASSET_VALUE, pad(16)] |
Contributor
There was a problem hiding this comment.
Ah, my bad, somehow I missed that we already have repeat.2 here. Yep, in that case all looks good!
mmagician
approved these changes
Mar 30, 2026
mmagician
added a commit
that referenced
this pull request
Mar 30, 2026
* refactor(agglayer): fix minor formatting issues (#2675) * refactor: fix minor formatting issues * fix: cleanup unecessary stack comments * fix: add newline * refactor: rename U256[N] to U256_LO/U256_HI in Agglayer MASM comments (#2676) * refactor: fix minor formatting issues * fix: cleanup unecessary stack comments * fix: add newline * Initial plan * refactor: rename U256[0]/U256[1] to U256_LO/U256_HI in Agglayer MASM comments Co-authored-by: mmagician <8402446+mmagician@users.noreply.github.com> Agent-Logs-Url: https://github.com/0xMiden/protocol/sessions/604803e2-68c0-4ffe-acdd-4926707426f5 * refactor: remove (4) size suffix from AMOUNT_U256_LO/HI in bridge_out.masm comments Co-authored-by: mmagician <8402446+mmagician@users.noreply.github.com> Agent-Logs-Url: https://github.com/0xMiden/protocol/sessions/ab585523-16e0-40fd-b99b-e64a472ef9d0 --------- Co-authored-by: riemann <aleqvids@gmail.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mmagician <8402446+mmagician@users.noreply.github.com> * fix: rm unused procedure (#2680) * fix(agglayer): update doc & stack comments (#2678) * fix: update stack comment in claim_batch_pipe_double_words * fix: update doc comments & formatting * fix(agglayer): remove pub proc definition from internal procs (#2679) * fix: remove pub proc definition from internal procs * fix: add stack comment & newline * AggLayer audit preparation fixes (#2686) * refactor: B2AGG: optimize stack management, update format, remove unused imports * refactor: CLAIM note: remove unused imports, update code format * refactor: CONFIG_AGG_BRIDGE: update code and formatting, remove unused imports * refactor: UPDATE_GER: remove unused imports, update format * chore: update comments format for agglayer account components --------- Co-authored-by: Marti <marti@miden.team> * Agglayer modules format unification (#2694) * refactor: faucet account: remove unused imports, update comments * refactor: update format of the bridge_config * refactor: update format in bridge_in * refactor: fix addr order in config note inline docs * refactor: update format of the bridge_out * refactor: update format of the leaf_utils, move EthereumAddressFormat to eth_address * chore: small format fixes * fix(agglayer): fix incorrect stack comments (#2681) * fix: fix incorrect stack comments * fix: rm plan md file * fix: undo incorrect padding drop * fix: update comment * chore: update AggLayer spec (#2710) * docs(agglayer): inline permissions into note type sections Move the standalone "Current permissions" table from section 1 into per-note-type "Permissions" sub-sections within section 3, making authorization details easier to find when reading about each note type. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs(agglayer): add Protocol Description section with audit TODOs Add a new Section 2 describing the high-level protocol flows (bridge-out, bridge-in, GER lifecycle, faucet registration, administration) with TODO markers linking to audit issue files for identified gaps relative to the Solidity v2 contracts. Renumber subsequent sections accordingly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: add flow diagrams * chore: clarify who monitors L1 --------- Co-authored-by: Claude (Opus) <noreply@anthropic.com> --------- Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: riemann <aleqvids@gmail.com> Co-authored-by: Andrey Khmuro <andrey@polygon.technology> Co-authored-by: Claude (Opus) <noreply@anthropic.com> Co-authored-by: Bobbin Threadbare <43513081+bobbinth@users.noreply.github.com>
mmagician
added a commit
that referenced
this pull request
Mar 30, 2026
* refactor(agglayer): fix minor formatting issues (#2675) * refactor: fix minor formatting issues * fix: cleanup unecessary stack comments * fix: add newline * refactor: rename U256[N] to U256_LO/U256_HI in Agglayer MASM comments (#2676) * refactor: fix minor formatting issues * fix: cleanup unecessary stack comments * fix: add newline * Initial plan * refactor: rename U256[0]/U256[1] to U256_LO/U256_HI in Agglayer MASM comments Co-authored-by: mmagician <8402446+mmagician@users.noreply.github.com> Agent-Logs-Url: https://github.com/0xMiden/protocol/sessions/604803e2-68c0-4ffe-acdd-4926707426f5 * refactor: remove (4) size suffix from AMOUNT_U256_LO/HI in bridge_out.masm comments Co-authored-by: mmagician <8402446+mmagician@users.noreply.github.com> Agent-Logs-Url: https://github.com/0xMiden/protocol/sessions/ab585523-16e0-40fd-b99b-e64a472ef9d0 --------- Co-authored-by: riemann <aleqvids@gmail.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mmagician <8402446+mmagician@users.noreply.github.com> * fix: rm unused procedure (#2680) * fix(agglayer): update doc & stack comments (#2678) * fix: update stack comment in claim_batch_pipe_double_words * fix: update doc comments & formatting * fix(agglayer): remove pub proc definition from internal procs (#2679) * fix: remove pub proc definition from internal procs * fix: add stack comment & newline * AggLayer audit preparation fixes (#2686) * refactor: B2AGG: optimize stack management, update format, remove unused imports * refactor: CLAIM note: remove unused imports, update code format * refactor: CONFIG_AGG_BRIDGE: update code and formatting, remove unused imports * refactor: UPDATE_GER: remove unused imports, update format * chore: update comments format for agglayer account components --------- Co-authored-by: Marti <marti@miden.team> * Agglayer modules format unification (#2694) * refactor: faucet account: remove unused imports, update comments * refactor: update format of the bridge_config * refactor: update format in bridge_in * refactor: fix addr order in config note inline docs * refactor: update format of the bridge_out * refactor: update format of the leaf_utils, move EthereumAddressFormat to eth_address * chore: small format fixes * fix(agglayer): fix incorrect stack comments (#2681) * fix: fix incorrect stack comments * fix: rm plan md file * fix: undo incorrect padding drop * fix: update comment * chore: update AggLayer spec (#2710) * docs(agglayer): inline permissions into note type sections Move the standalone "Current permissions" table from section 1 into per-note-type "Permissions" sub-sections within section 3, making authorization details easier to find when reading about each note type. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs(agglayer): add Protocol Description section with audit TODOs Add a new Section 2 describing the high-level protocol flows (bridge-out, bridge-in, GER lifecycle, faucet registration, administration) with TODO markers linking to audit issue files for identified gaps relative to the Solidity v2 contracts. Renumber subsequent sections accordingly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: add flow diagrams * chore: clarify who monitors L1 --------- Co-authored-by: Claude (Opus) <noreply@anthropic.com> --------- Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: riemann <aleqvids@gmail.com> Co-authored-by: Andrey Khmuro <andrey@polygon.technology> Co-authored-by: Claude (Opus) <noreply@anthropic.com> Co-authored-by: Bobbin Threadbare <43513081+bobbinth@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes incorrect stack comments found in
crates/miden-agglayer/asm/.Summary:
1.
bridge_in.masm— MissingDEFAULT_TAGafter pushLocation:
create_mint_note_with_attachmentAfter
push.DEFAULT_TAG, the comment omitted the newly pushed value:2.
bridge_in.masm— prefix/suffix order swapped in three proceduresLocation:
build_mint_output_note,create_mint_note_with_attachmentComments throughout the MINT note creation flow had
faucet_id_prefixandfaucet_id_suffixin the wrong order. The actual stack hassuffixon top (matchingkey_to_faucet_id's output), but comments saidprefixwas on top. This was as a result of the VM stack ordering update, these were just comments that didn't get updated.All downstream comments within
create_mint_note_with_attachmentwere updated to match.3.
leaf_utils.masm— Variable name typo (curr_lsb→curr_msb)Location:
pack_leaf_dataThe value at that stack position is the result of
u32shr.24, which extracts the upper 8 bits (MSB) of the current u32 element. The existing comment on line 97 already describes this as "extract MSB (upper 8 bits)", and line 109 references it ascurr_msb. The intermediate comments on lines 103 and 107 were inconsistent, usingcurr_lsbinstead:4.
bridge_out.masm— Padding cleanup countLocation:
convert_assetThe FPI call to
asset_to_origin_assetreturns[U256(8), addr(5), origin_network, pad(2)]— exactly 2 padding elements. The cleanup was corrected fromrepeat.3torepeat.2and the comment updated accordingly.